<?php
$conn = @mysqli_connect('192.168.10.123', 'root', '123456', 'bbs', 13306);
if (!$conn) {// 检查是否连接成功 也可以使用mysqli_connect_errno()判断
    die("连接数据库错误: " . mysqli_connect_error());
}
mysqli_query($conn,"set names utf8"); //执行insert
mysqli_query($conn,"insert into users (username,age,sex) values('张三丰',68,'男')"); //执行insert
$num1 = mysqli_affected_rows($conn);
echo "影响行数为: {$num1} <br>";

$result = mysqli_query($conn,"select * from users"); // 执行select
$num2 = mysqli_num_rows($result);
echo "查询总条数: {$num2} <br>";
mysqli_free_result($result);
mysqli_close($conn); // 关闭数据库连接